package com.wyl.auth.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Description 用户操作日志
 * @Author WuYiLong
 * @Date 2025-04-16
 */
@Data
@TableName("user_operation_log")
@Entity
@Table(name="user_operation_log")
@org.hibernate.annotations.Table(appliesTo = "user_operation_log",comment = "用户操作日志")
public class UserOperationLog extends Model<UserOperationLog> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(columnDefinition = "bigint comment '主键id'")
    private Long id;

    @Column(columnDefinition = "bigint comment '用户id'")
    private Long userId;

    @Column(columnDefinition = "varchar(255) comment '用户名'")
    private String username;

    @Column(columnDefinition = "varchar(200) comment '请求路径'")
    private String requestPath;

    @Column(columnDefinition = "varchar(200) comment '请求路径名称'")
    private String requestPathName;

    @Column(columnDefinition = "varchar(200) comment 'ip地址'")
    private String ipAddress;

    @Column(columnDefinition = "bigint comment '耗时（毫秒）'")
    private Long timeCost;

    @Column(columnDefinition = "datetime comment '创建时间'")
    private LocalDateTime createTime;

    @Override
    public Serializable pkVal() {
        return this.id;
    }

}
